package io;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class demo3 {
    public static void main(String[] args) throws IOException {
        File file = new File("./test.txt");
        //创建文件，权限
        file.createNewFile();
        //删除文件
        file.delete();

        file.createNewFile();
        System.out.println("创建文件成功");
        //进程退出后，才触发删除
        file.deleteOnExit();
        System.out.println("使用deleteOnExit");
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入任意内容，退出程序");
        scanner.nextLine();

    }
}
